<?php
session_start(); 
if(!isset($_SESSION['userName'])){
header( 'location:../../index.php' ); 
}
	include("../../conf/connect.php");
	$user_id = $_SESSION['user_id'];
	$hhid= $_GET['hhid'];
	$bid= $_GET['bid'];
	
	if ($bid==3){
		$_SESSION['usrHHid']=$hhid;
		header( 'location: ../rel_detail.php' );
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../../style.css" media="screen" />
	<link rel="shortcut icon" href="../images/favicon.ico" />
</head>
<body class="iub_back">
	<form method="post" action="update_operation.php?qus=upd3">
	<table align="center" class="table_border">
			<tr>
					<td class="header"><b class="htext">IUB Survey :: </b><br /><hr /> </td>
			</tr>
			<tr>
					<td> Field : </td>
			</tr>
			<?php
				$sql ="SELECT * FROM household_economic where hid='$hhid'";
				$result=mysql_query( $sql);
				while($row = mysql_fetch_assoc($result)){
				?>
			<tr>
					<td><input type="hidden" name="bid" value="<?php echo $bid;?> " />
						<select name="qusNo">						
								<option value="q70">HEH01A</option>
								<option value="q71">HEH01B</option>
								<option value="q72">HEH01C</option>
								<option value="q73">HEH01D</option>
								<option value="q74">HEH01E</option>
								<option value="q75">HEH01F</option>
								<option value="q76">HEH01G</option>
								<option value="q77" <?php if($row['heh01_a']=='3'){?> disabled="disabled"<?php }?>>HEH02A</option>
								<option value="q78" <?php if($row['heh01_b']=='3'){?> disabled="disabled"<?php }?>>HEH02B</option>
								<option value="q79" <?php if($row['heh01_c']=='3'){?> disabled="disabled"<?php }?>>HEH02C</option>
								<option value="q80" <?php if($row['heh01_d']=='3'){?> disabled="disabled"<?php }?>>HEH02D</option>
								<option value="q81" <?php if($row['heh01_e']=='3'){?> disabled="disabled"<?php }?>>HEH02E</option>
								<option value="q82" <?php if($row['heh01_f']=='3'){?> disabled="disabled"<?php }?>>HEH02F</option>
								<option value="q83" <?php if($row['heh01_g']=='3'){?> disabled="disabled"<?php }?>>HEH02G</option>
								<option value="q84" <?php if($row['heh01_a']=='3'||$row['heh02_a']=='3'){?> disabled="disabled"<?php }?>>HEH03A</option>
								<option value="q85" <?php if($row['heh01_b']=='3'||$row['heh02_b']=='3'){?> disabled="disabled"<?php }?>>HEH03B</option>
								<option value="q86" <?php if($row['heh01_c']=='3'||$row['heh02_c']=='3'){?> disabled="disabled"<?php }?>>HEH03C</option>
								<option value="q87" <?php if($row['heh01_d']=='3'||$row['heh02_d']=='3'){?> disabled="disabled"<?php }?>>HEH03D</option>
								<option value="q88" <?php if($row['heh01_e']=='3'||$row['heh02_e']=='3'){?> disabled="disabled"<?php }?>>HEH03E</option>
								<option value="q89" <?php if($row['heh01_f']=='3'||$row['heh02_f']=='3'){?> disabled="disabled"<?php }?>>HEH03F</option>
								<option value="q88" <?php if($row['heh01_g']=='3'||$row['heh02_g']=='3'){?> disabled="disabled"<?php }?>>HEH03G</option>
								<option value="q88" <?php if($row['heh01_a']=='3'||$row['heh02_a']=='3'){?> disabled="disabled"<?php }?>>HEH04A</option>
								<option value="q88" <?php if($row['heh01_b']=='3'||$row['heh02_b']=='3'){?> disabled="disabled"<?php }?>>HEH04B</option>
								<option value="q88" <?php if($row['heh01_c']=='3'||$row['heh02_c']=='3'){?> disabled="disabled"<?php }?>>HEH04C</option>
								<option value="q88" <?php if($row['heh01_d']=='3'||$row['heh02_d']=='3'){?> disabled="disabled"<?php }?>>HEH04D</option>
								<option value="q88" <?php if($row['heh01_e']=='3'||$row['heh02_e']=='3'){?> disabled="disabled"<?php }?>>HEH04E</option>	
								<option value="q88" <?php if($row['heh01_f']=='3'||$row['heh02_f']=='3'){?> disabled="disabled"<?php }?>>HEH04F</option>
								<option value="q88" <?php if($row['heh01_g']=='3'||$row['heh02_g']=='3'){?> disabled="disabled"<?php }?>>HEH04G</option>															
						</select>
					</td>
			</tr>
			<?php }?>
			<tr>
					<td align="right" valign="bottom"><input type="submit" value="Update" class="input-box" /> &nbsp;&nbsp;<a href="../index2.php" class="input-box"> Home &nbsp;&nbsp; </a></td>
			</tr>
			<tr>
					<td> <i>Answer(s)</i> : <input type="hidden" name="hhhid" value="<?php echo $hhid;?>" /></td>
			</tr>
			 		
			<?php
				$sql ="SELECT * FROM household_economic where hid='$hhid'";
				$result=mysql_query( $sql);
				while($row = mysql_fetch_assoc($result)){
				?>	
			<tr>
					<td>Last 1 Yr. Happenings:</td>
			</tr>
			<tr>
					<td>HEH01A: Death&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_a'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_a' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?> 
					</td>
			</tr>
			<tr>
					<td>HEH01B: Illness&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_b'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_b' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?> </td>
			</tr>
			<tr>
					<td>HEH01C: Crop Loss&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_c'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_c' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?> </td>
			</tr>
			<tr>
					<td>HEH01D: Natural Disaster&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_d'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_d' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?> </td>
			</tr>
			<tr>
					<td>HEH01E: Loss of job&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_e'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_e' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?> </td>
			</tr>
			<tr>
					<td>HEH01F: Low crop price&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_f'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_f' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr>
					<td>HEH01G: Business Loss&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh01_g'];
						
						$hello="SELECT * FROM retreive_data where qus='heh01_g' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr>
					<td><br />Economic Hardship Causes</td>
			</tr>	
			<tr <?php if($row['heh01_a']==3){?> style="display:none"<?php }?>>
					<td>HEH02A: Death&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_a'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_a' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr <?php if($row['heh01_b']==3){?> style="display:none"<?php }?>>
					<td>HEH02B: Illness&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_b'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_b' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr <?php if($row['heh01_c']==3){?> style="display:none"<?php }?>>
					<td>HEH02C: Crop Loss&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_c'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_c' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr <?php if($row['heh01_d']==3){?> style="display:none"<?php }?>>
					<td>HEH02D: Natural Disaster&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_d'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_d' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr <?php if($row['heh01_e']==3){?> style="display:none"<?php }?>>
					<td>HEH02E: Loss of job&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_e'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_e' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr <?php if($row['heh01_f']==3){?> style="display:none"<?php }?>>
					<td>HEH02F: Low crop price&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_f'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_f' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr <?php if($row['heh01_g']==3){?> style="display:none"<?php }?>>
					<td>HEH02G: Business Loss&nbsp;:&nbsp; 
					<?php 
						$data=$row['heh02_g'];
						
						$hello="SELECT * FROM retreive_data where qus='heh02_g' and hoption='$data'";
						$end=mysql_query($hello);
						while($value=mysql_fetch_array($end)){
							echo $value['value'];;
						}
						?></td>
			</tr>
			<tr>
					<td><br />How long ago?</td>
			</tr>
			<tr <?php if($row['heh01_a']=='3'||$row['heh02_a']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03A: Death&nbsp;:&nbsp; <?php echo $row['heh03_a'];?></td>
			</tr>
			<tr <?php if($row['heh01_b']=='3'||$row['heh02_b']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03B: Illness&nbsp;:&nbsp; <?php echo $row['heh03_b'];?></td>
			</tr>
			<tr <?php if($row['heh01_c']=='3'||$row['heh02_c']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03C: Crop Loss&nbsp;:&nbsp;<?php echo $row['heh03_c'];?></td>
			</tr>
			<tr <?php if($row['heh01_d']=='3'||$row['heh02_d']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03D: Natural Disaster&nbsp;:&nbsp; <?php echo $row['heh03_d'];?></td>
			</tr>
			<tr <?php if($row['heh01_e']=='3'||$row['heh02_e']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03E: Loss of job&nbsp;:&nbsp; <?php echo $row['heh03_e'];?></td>
			</tr>
			<tr <?php if($row['heh01_f']=='3'||$row['heh02_f']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03F: Low crop price&nbsp;:&nbsp; <?php echo $row['heh03_f'];?></td>
			</tr>
			<tr <?php if($row['heh01_g']=='3'||$row['heh02_g']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH03G: Business Loss&nbsp;:&nbsp; <?php echo $row['heh03_g'];?></td>
			</tr>
			<tr>
					<td><br />Recovery Measures</td>
			</tr>
			<tr <?php if($row['heh01_a']=='3'||$row['heh02_a']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04A: Death&nbsp;:&nbsp; <?php echo $row['heh04_a'];?></td>
			</tr>
			<tr <?php if($row['heh01_b']=='3'||$row['heh02_b']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04B: Illness&nbsp;:&nbsp; <?php echo $row['heh04_b'];?></td>
			</tr>
			<tr <?php if($row['heh01_c']=='3'||$row['heh02_c']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04C: Crop Loss&nbsp;:&nbsp;<?php echo $row['heh04_c'];?></td>
			</tr>
			<tr <?php if($row['heh01_d']=='3'||$row['heh02_d']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04D: Natural Disaster&nbsp;:&nbsp; <?php echo $row['heh04_d'];?></td>
			</tr>
			<tr <?php if($row['heh01_e']=='3'||$row['heh02_e']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04E: Loss of job&nbsp;:&nbsp; <?php echo $row['heh04_e'];?></td>
			</tr>
			<tr <?php if($row['heh01_f']=='3'||$row['heh02_f']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04F: Low crop price&nbsp;:&nbsp; <?php echo $row['heh04_f'];?></td>
			</tr>
			<tr <?php if($row['heh01_g']=='3'||$row['heh02_g']=='3'){?> style="display:none;"<?php }?>>
					<td>HEH04G: Business Loss&nbsp;:&nbsp; <?php echo $row['heh04_g'];?></td>
			</tr>
			<?php 		
								
				}			
			?>
						
		</table>
		</form>
</body>
</html>